package com.liugl.listtest

import android.app.Activity

object ActivityController {
    private val activities = ArrayList<Activity>()

    fun addActivity(activity: Activity){
        activities.add(activity)
    }

    fun removeActivity(activity: Activity){
        activities.remove(activity)
    }

    fun finishAll(){
        for (a in activities){
            if(!a.isFinishing){
                a.finish()
            }
        }

        activities.clear()
        android.os.Process.killProcess(android.os.Process.myPid())
    }
}